package top.healthylife.gateway.platform.eye.api.api.renyuanxiangguan;

import cn.hutool.core.bean.BeanUtil;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
import top.healthylife.gateway.core.service.ParentFace;
import top.healthylife.gateway.core.util.SystemConfigUtils;
import top.healthylife.gateway.dto.annotation.ApiServiceExplain;
import top.healthylife.gateway.platform.eye.api.config.SystemConfig;
import top.healthylife.gateway.platform.eye.api.util.OutHttpUtil;
import top.healthylife.gateway.platform.eye.dto.renyuanxiangguan.EyeReqCompanyHoldingDto.req.EyeReqCompanyHoldingDto;
import top.healthylife.gateway.platform.eye.dto.renyuanxiangguan.EyeReqCompanyHoldingDto.res.EyeResCompanyHoldingDto;

/**
* @author: GenUtil
* @date: 2020-12-15 19:07:18
*/
@Slf4j
@Service
@ApiServiceExplain(price = 100,docUrl ="http://open.tianyancha.com/open/1033",apiName = "人员控股企业[1033]", info = "可以通过公司名称、人名获取人员控股企业信息，人员控股企业信息包括控股企业ID、投资比例、企业logo、企业简称、控股企业、注册资本、法人类型、经营状态、法人等字段的信息")
public class EyeCompanyHoldingApi implements ParentFace<EyeReqCompanyHoldingDto, EyeResCompanyHoldingDto> {

    static final String URL = "http://open.api.tianyancha.com/services/open/human/companyholding/2.0";

    /**
     * 执行这个服务接口
     * 如果成功，返回成功结果，如果接口错误，直接抛异常即可
     *
     * @param eyeDto 请求参数
     * @return 查询的真实结果，如果是失败，则直接返回异常即可
     */
    @Override
    public EyeResCompanyHoldingDto execute(EyeReqCompanyHoldingDto eyeDto) {
        //可直接通过工具类获取这个对象
        SystemConfig o = (SystemConfig) SystemConfigUtils.get();
        return OutHttpUtil.get(URL, BeanUtil.beanToMap(eyeDto), o, EyeResCompanyHoldingDto.class);
    }
}
